Imports System
Imports Microsoft.VisualBasic
  Partial Class searchGarage_aspx_vb
    Inherits Functions
    
    Public strGrey As String 
    Public rowNumber As Integer 
    Public subDo As String 
    Public garageCount As Object 
    Public country As Object ' System.Object
    Public userID As Object 
    Public garage As Object 
    Public garageID As Object 
    Public street As String 
    Public zipcode As String 
    Public city As Object 
    Public areacode As String 
    Public telephone As String 
    Public fax As String 
    Public email As String 
    Public note As Object 
    Public sqlCountryID As String 
    Public sqlGarage As String 
    Public sqlGarageID As String 
    Public sqlStreet As String 
    Public sqlZipcode As String 
    Public sqlCity As String 
    Public sqlAreacode As String 
    Public sqlTelephone As String 
    Public sqlFax As String 
    Public sqlEmail As String 
    Public sqlNote As String 
    Public vehicleID As Object ' System.Object
    Public __date As Object ' System.Object
    Public regnr As Object ' System.Object
    Public vinNumber As Object ' System.Object
    Public product As Object ' System.Object
    Public brand As Object ' System.Object
    Public model As Object ' System.Object
    Public countryCurrency As Object ' System.Object
    Public claimStatus As Object ' System.Object
    Public strClaimStatus As String 
    Public requestedAmount As Object ' System.Object
    Public approvedAmount As Object ' System.Object
    Public claimCount As Object ' System.Object
    Public claimSum As Object 
    Public claimAmount As Object 
    Public authorisedClaimAmount As Object 
    Public claimMomentSum As Object 
    Public claimPartSum As Object 
    Public claimServiceSum As Object 
    Public consumptionMaterialSum As Object 
    Public authorisedClaimMomentSum As Object 
    Public authorisedClaimPartSum As Object 
    Public authorisedClaimServiceSum As Object 
    Public authorisedConsumptionMaterialSum As Object 
    Public authorisedPercentage As Double 
    Public garageInvoiceID As Object 
    Public sqlGarageInvoiceID As String 
    Public sqlGarageInvoiceIDLeft As String 
    Public sqlGarageInvoiceIDRight As String 
    


    Public Function GetRecSet() As String
       
            RecSet = Conn.Execute("Select c.countryCurrency, (Select Count(c.claimID) From tblClaim c Where c.garageID = g.garageID) As claimCount, (Select Sum(c.paymentAmount) From tblClaim c Where c.garageID = g.garageID) As claimSum, (Select Sum(cm.costPerHour*cm.numberOfHours) From (tblClaimMoment cm INNER JOIN tblClaim c ON c.claimID = cm.claimID) Where c.garageID = g.garageID) As claimMomentSum, (Select Sum(cp.costPerPart*cp.numberOfParts) From (tblClaimPart cp INNER JOIN tblClaim c ON c.claimID = cp.claimID) Where c.garageID = g.garageID) As claimPartSum, (Select Sum(cs.costPerService*cs.numberOfService) From (tblClaimService cs INNER JOIN tblClaim c ON c.claimID = cs.claimID) Where c.garageID = g.garageID) As claimServiceSum, (Select Sum(c.consumptionMaterialAmount) From tblClaim c Where c.garageID = g.garageID) As consumptionMaterialSum, (Select Sum(cm.authorisedCostPerHour*cm.authorisedNumberOfHours) From (tblClaimMoment cm INNER JOIN tblClaim c ON c.claimID = cm.claimID) Where c.garageID = g.garageID) As authorisedClaimMomentSum, (Select Sum(cp.authorisedCostPerPart*cp.authorisedNumberOfParts) From (tblClaimPart cp INNER JOIN tblClaim c ON c.claimID = cp.claimID) Where c.garageID = g.garageID) As authorisedClaimPartSum, (Select Sum(cs.authorisedCostPerService*cs.authorisedNumberOfService) From (tblClaimService cs INNER JOIN tblClaim c ON c.claimID = cs.claimID) Where c.garageID = g.garageID) As authorisedClaimServiceSum, (Select Sum(c.authorizedConsumptionMaterialAmount) From tblClaim c Where c.garageID = g.garageID) As authorisedConsumptionMaterialSum From (tblGarage g INNER JOIN tblCountry c ON c.countryID = g.countryID) Where g.garageID = " & garageID & "")
            If Not RecSet.EOF Then
                countryCurrency = RecSet.Fields("countryCurrency").Value
                claimCount = RecSet.Fields("claimCount").Value
                claimSum = RecSet.Fields("claimSum").Value
                claimMomentSum = RecSet.Fields("claimMomentSum").Value
                claimPartSum = RecSet.Fields("claimPartSum").Value
                claimServiceSum = RecSet.Fields("claimServiceSum").Value
                consumptionMaterialSum = RecSet.Fields("consumptionMaterialSum").Value
                authorisedClaimMomentSum = RecSet.Fields("authorisedClaimMomentSum").Value
                authorisedClaimPartSum = RecSet.Fields("authorisedClaimPartSum").Value
                authorisedClaimServiceSum = RecSet.Fields("authorisedClaimServiceSum").Value
                authorisedConsumptionMaterialSum = RecSet.Fields("authorisedConsumptionMaterialSum").Value
            End If
           

        Return GetRecSet()
    End Function

    Public Function IsNullChecking(isNull As Integer) As Integer
        If IsDBNull(isNull) Then
            isNull = 0
        End If

        IsNullChecking = isNull
    End Function

    
End Class
